<%--
  Created by IntelliJ IDEA.
  User: LJS
  Date: 2018/11/15
  Time: 0:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page trimDirectiveWhitespaces="true"%>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName()
            + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>公司费用报销表</title>
    <jsp:include page="resource.jsp"/>
    <script type="text/javascript">
        function addrow(){
            for(var i = 1; i < 100; i++){
                var indexName="details"+1;
                var trHTML = "<tr><td><input type='text' class='form-control limitInput' maxlength='20' id='"+indexName+'1'+"' name='"+"expenseItemType"+"' /></td>"
                    +"<td><input type='text' class='form-control limitInput' maxlength='20' id='"+indexName+'2'+"' name='"+"expenseItemName"+"' /></td>"
                    +"<td><input type='text' class='form-control limitInput' maxlength='20' id='"+indexName+'3'+"' name='"+"expenseItemUnitPrice"+"' /></td>"
                    +"<td><input type='text' class='form-control limitInput' maxlength='20' id='"+indexName+'4'+"' name='"+"expenseItemNum"+"' /></td>"
                    +"<td><input type='text' class='form-control limitInput' maxlength='20' id='"+indexName+'5'+"' name='"+"expenseItemTotalPrice"+"' /></td></tr>";
            }
            $("#details-table").append(trHTML);//在table最后面添加一行
        }
        function deleteTrRow(){
            $("#details-table tr:not(:first):not(:first):last").remove(); //移除最后一行,并且保留前两行
            //$(this).closest('tr').remove();
        }
    </script>
</head>
<body>
<jsp:include page="common.jsp"/>

<!-- Start #content -->
<div id="content">
    <!-- Start .content-wrapper -->
    <div class="content-wrapper">
        <!-- Start .row -->
        <div class="row">
            <!-- Start .page-header -->
            <div class="col-lg-12 heading">
                <h1 class="page-header"><i class="st-chart"></i> 公司费用报销表</h1>
            </div>
            <!-- End .page-header -->
        </div>
        <!-- End .row -->
        <!-- Start .outlet -->
        <div class="outlet">
            <!-- Page start here ( usual with .row ) -->
            <div class="row printable">
                <!-- col-lg-12 start here -->
                <div class="col-lg-12">
                    <!-- Start .panel -->
                    <div class="panel panel-default plain">
                        <div class="panel-heading white-bg"></div>
                        <div class="panel-body">
                            <!-- Start .invoice -->
                            <div class="invoice">
                                <!-- auth -->
                                <%--<a href="<%=basePath%>expense/person/list.do" class="mt25">返回</a>--%>
                                <a href="<%=basePath%>expense/all/search.do" class="mt25">返回</a>
                                <a href="javacript:void(0);" class="pull-right mb5 mr15 btn-xs btn-success">通过</a>
                                <a href="javacript:void(0);" class="pull-right mb5 mr15 btn-xs btn-warning">驳回</a>
                                <div class="clearfix"></div>
                                <form class="form-horizontal" id="invoice-form" action="<%=basePath%>expense/insert.do" method="post">
                                    <table class="table table-bordered">
                                        <tr>
                                            <td width="15%">
                                                <label for="expenseDepartment" class="control-label">报销部门</label>
                                            </td>
                                            <td width="35%">
                                                <input type="text" class="form-control limitInput" maxlength="20"
                                                       id="expenseDepartment" name="expenseDepartment">
                                                <%--<select class="form-control">
                                                    <option value="">--请选择--</option>
                                                    <option value="">人事部</option>
                                                    <option value="">技术部</option>
                                                    <option value="">营销部</option>
                                                </select>--%>
                                            </td>
                                            <td width="15%">
                                                <label for="expenseDealName" class="control-label">经办主管</label>
                                            </td>
                                            <td width="35%">
                                                <input type="text" class="form-control limitInput" maxlength="20"
                                                       id="expenseDealName" name="expenseDealName">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td><label for="details01" class="control-label">报销内容</label></td>
                                            <td colspan="3">
                                                <table class="table table-bordered" id="details-table">
                                                    <tr>
                                                        <td>项目种类</td>
                                                        <td>项目名称</td>
                                                        <td>项目单价</td>
                                                        <td>项目数量</td>
                                                        <td>项目总价</td>
                                                    </tr>
                                                    <tr>
                                                        <td><input type="text" class="form-control limitInput" maxlength="20" id="details01" name="expenseItemType"></td>
                                                        <td><input type="text" class="form-control limitInput" maxlength="20" id="details02" name="expenseItemName"></td>
                                                        <td><input type="text" class="form-control limitInput" maxlength="20" id="details03" name="expenseItemUnitPrice"></td>
                                                        <td><input type="text" class="form-control limitInput" maxlength="20" id="details04" name="expenseItemNum"></td>
                                                        <td><input type="text" class="form-control limitInput" maxlength="20" id="details05" name="expenseItemTotalPrice"></td>
                                                    </tr>
                                                </table>
                                                <input type="button" class="btn btn-xs btn-primary" onclick="addrow();" value="新增一行" />
                                                <input type="button" class="btn btn-xs btn-danger" onclick="deleteTrRow();" value="删除一行" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td width="15%">
                                                <label for="expenseTotal" class="control-label">报销总额</label>
                                            </td>
                                            <td width="35%">
                                                <div class="input-group">
                                                    <span class="input-group-addon">￥</span>
                                                    <!-- 报销总额最低0，最高9999，精确值到小数点后两位 -->
                                                    <input type="number" class="form-control" min="0" max="9999" step="0.01"
                                                           id="expenseTotal" name="expenseTotal" oninput="if(value>9999)value=9999;if(value.length>7)value=value.slice(0,7);if(value<0)value=0" />
                                                </div>
                                            </td>
                                            <td width="15%">
                                                <label for="expenseWay" class="control-label">报销方式</label>
                                            </td>
                                            <td width="35%">
                                                <select class="form-control" id="expenseWay" name="expenseWay">
                                                    <option value="">--请选择--</option>
                                                    <c:forEach items="${expenseWayList}" var="way">
                                                        <option value="${way.dictId}">${way.dictItemName}</option>
                                                    </c:forEach>
                                                </select>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td width="15%">
                                                <label for="expenseReceiveDepartment" class="control-label">受款单位</label>
                                            </td>
                                            <td width="35%">
                                                <input type="text" class="form-control limitInput" maxlength="20"
                                                       id="expenseReceiveDepartment" name="expenseReceiveDepartment">
                                            </td>
                                            <td width="15%">
                                                <label for="expenseReceiveAccount" class="control-label">受款账号</label>
                                            </td>
                                            <td width="35%">
                                                <input type="text" class="form-control limitInput" maxlength="20"
                                                       id="expenseReceiveAccount" name="expenseReceiveAccount">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td width="15%">
                                                <label for="expenseReceiveBank" class="control-label">所属银行</label>
                                            </td>
                                            <td width="35%">
                                                <input type="text" class="form-control limitInput" maxlength="20"
                                                       id="expenseReceiveBank" name="expenseReceiveBank">
                                            </td>
                                            <td width="15%">
                                                <label for="generalManagerStaffName" class="control-label">总经理</label>
                                            </td>
                                            <td width="35%">
                                                <input type="text" class="form-control limitInput" maxlength="20"
                                                       id="generalManagerStaffName" name="generalManagerStaffName">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td width="15%">
                                                <label for="departManagerStaffName" class="control-label">部门经理</label>
                                            </td>
                                            <td width="35%">
                                                <input type="text" class="form-control limitInput" maxlength="20"
                                                       id="departManagerStaffName" name="departManagerStaffName">
                                            </td>
                                            <td width="15%">
                                                <label for="auditorStaffName" class="control-label">财务经理</label>
                                            </td>
                                            <td width="35%">
                                                <input type="text" class="form-control limitInput" maxlength="20"
                                                       id="auditorStaffName" name="auditorStaffName">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td width="15%">
                                                <label for="expenseStaffNo" class="control-label">报销工号</label>
                                            </td>
                                            <td width="35%">
                                                <input type="text" class="form-control limitInput" maxlength="20"
                                                       id="expenseStaffNo" name="expenseStaffNo">
                                            </td>
                                            <td width="15%">
                                                <label for="expenseStaffName" class="control-label">报销员工</label>
                                            </td>
                                            <td width="35%">
                                                <input type="text" class="form-control limitInput" maxlength="20"
                                                       id="expenseStaffName" name="expenseStaffName">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td width="15%">
                                                <label for="expenseResult" class="control-label">报销结果</label>
                                            </td>
                                            <td width="35%">
                                                <select class="form-control" id="expenseResult" name="expenseResult">
                                                    <option value="">--请选择--</option>
                                                    <c:forEach items="${expenseResultList}" var="result">
                                                        <option value="${result.dictId}">${result.dictItemName}</option>
                                                    </c:forEach>
                                                </select>
                                            </td>
                                        </tr>
                                    </table>
                                    <div class="form-group">
                                        <input type="submit" class="btn btn-primary col-md-3 col-md-offset-5" value="保存" />
                                    </div>
                                </form>
                            </div>
                            <!-- End .invoice -->
                        </div>
                    </div>
                    <!-- End .panel -->
                </div>
                <!-- col-lg-12 end here -->
            </div>
            <!-- Page End here -->
        </div>
        <!-- End .outlet -->
    </div>
    <!-- End .content-wrapper -->
    <div class="clearfix"></div>
</div>
<!-- End #content -->
</body>
</html>

